import logging

from src.ModelPredictServer import ModelPredictServer
from src.UserManageServer import UserManageServer
from multiprocessing import Process
import os

# 日志存储文件夹
if not os.path.exists("./log"):
    os.mkdir("./log")

# sqlite数据库文件夹
if not os.path.exists("./database"):
    os.mkdir("./database")


logging.basicConfig(filename="./log/MyoEchoLog.txt", filemode='a', format="%(asctime)s [%(funcName)s:%(lineno)d]: %(message)s", datefmt="%Y-%m-%d %H:%M:%S", level=logging.INFO)

# 启动应用
if __name__ == "__main__":

    ModelServer = ModelPredictServer([".avi",".mp4",".dcm"],"0.0.0.0",7861,"./storage_dir")
    UserServer = UserManageServer("0.0.0.0",7862)
    # 分别启动两个进程
    model_server_p = Process(target=ModelServer.run)
    user_server_p = Process(target=UserServer.run)
    model_server_p.start()
    user_server_p.start()
    model_server_p.join()
    user_server_p.join()



